package com.cedric.yixianpai.game.cards.Sects.swordCards.c_JinDan;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Yun_HuiLing extends SwordCard {
    /**
     * title:云剑·汇灵
     * effect:7/11/15 连云：没连续用过1张云剑加1灵气
     */
    public Yun_HuiLing(@Value("1") int lvl) {
        super("云剑·汇灵");
        this.setLevel(lvl);
        this.setPeriod(Period.JINDAN);
        this.setDescription("7/11/15攻 连云：没连续用过1张云剑加1灵气");

        if (1 == lvl) {
            this.setDamage(7);
        } else if (2 == lvl) {
            this.setDamage(11);
        } else if (3 == lvl) {
            this.setDamage(15);
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.attack(Sta2, this.getDamage());
        if (Sta1.lastIs(CardType.YUN)) {
            int addSE = Sta1.getPlayerBuff().getYun_Consecutive();
            if(addSE>0) {
                Sta1.getPlayerBuff().addSpiritualEnergy(addSE);
            }
        }
        return true;
    }
}
